package learningThread.syn.synchronizedMethodLockObj.lock.queueLength;

import java.util.concurrent.locks.ReentrantLock;

/**
 * getHoldCount 返回当前线程保持此锁的个数,也就是调用 lock()方法的次数
 */
public class Service {

    public ReentrantLock lock = new ReentrantLock();

    public void serviceMethod(){

        try {
            lock.lock();
            System.out.println("Thread="+Thread.currentThread().getName()+",进入方法");
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            lock.unlock();
        }

    }


}
